<?php
USE_PAGE('index');

class PageRetour_commande extends Page
	{
	protected function build()
		{
		$this->addVar( 'BILLNUM', Bills::getOrderId() );
		}
		
	protected function _process( $processor = null, $ret = false )
		{
		if( Params::hasParam('ch') )
			{
			Bills::isOkToProceed();
			Bills::logBill( Params::getParam('ch'), 'CHEQUE' );
			Page::addVar('BILLNUM',Params::getParam('ch'));
			Bills::processPaisec( 0, Params::getParam('ch'), 'ch', 0, new DefaultBiller );
			}
		else
		if( Params::hasParam('md') )
			{
			Bills::isOkToProceed();
			Bills::logBill( Params::getParam('md'), 'MANDAT' );
			Page::addVar('BILLNUM',Params::getParam('md'));
			Bills::processPaisec( 0, Params::getParam('md'), 'md', 0, new DefaultBiller );
			}
		else
		if( Params::hasParam('st') )
			{
			Bills::isOkToProceed();
			Bills::logBill( Params::getParam('st'), 'STORE' );
			Page::addVar('BILLNUM',Params::getParam('st'));
			Bills::processPaisec( 0, Params::getParam('st'), 'st', 0, new DefaultBiller );
			}
		else
		if( Params::hasParam('pt') )
			{
			Bills::isOkToProceed();
			Bills::logBill( Params::getParam('pt'), 'POINTS' );
			Page::addVar('BILLNUM',Params::getParam('pt'));
			Bills::processPaisec( 0, Params::getParam('pt'), 'pt', 0, new DefaultBiller );
			}
		else
		if( Params::hasParam('cr') )
			{
			Bills::isOkToProceed();
			Bills::logBill( Params::getParam('cr'), 'CREDITS' );
			Page::addVar('BILLNUM',Params::getParam('cr'));
			Bills::processPaisec( 0, Params::getParam('cr'), 'cr', 0, new DefaultBiller );
			}
		Bills::selfClear( null );
		}

	protected function getPageUrl() { return '/retour-commande'; }
	protected function getBreadcrumbTitle() { return ''; }
	protected function getPageParent() { return 'PageIndex'; }
	}
?>